package InetAddress;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

import java.net.InetAddress;

public class InetAddressDemo1
{
    public static void main(String[] args) throws Exception {
        InetAddress localHost = InetAddress.getLocalHost(); //获取本地对象
        System.out.println(localHost);
        System.out.println(localHost.getHostAddress());
        System.out.println(localHost.getHostName());
        InetAddress baidu = InetAddress.getByName("www.baidu.com");
        System.out.println(baidu.getHostAddress());
        System.out.println(baidu.getHostName());
    }
}
